import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.lang.*;

/**
 * @author BianWenKai
 * @Data 2021/6/6 - 10:35
 **/
public class ListItALL {
    static long sum = 0;
    public static void main(String[] args) {
        int a[] = new int[10];
        ArrayList<Integer> array = new ArrayList<>();
        Set<Integer> set = new HashSet<>();
        for (int m = 1; m < 10; m++) {
            Scanner sc = new Scanner(System.in);
            a[m] = sc.nextInt();
            if (a[m] != 0){
                for (int n = 0; n < a[m]; n++) {
                    array.add(m);
                }
            }
        }
        for (Integer arr : array) {
            System.out.print(arr+"  ");
        }
        for (int i = 0; i < array.size(); i++) {
            for (int j = 0; j < array.size(); j++) {
                for (int k = 0; k < array.size(); k++) {
                    if (i != k && i != j && j != k) {
                        set.add(array.get(i) * 100 + array.get(j) * 10 + array.get(k));
                    }
                }
            }
        }
        for (Integer num : set) {
            System.out.println(num);
            sum += num;
        }
        System.out.println(sum);
        sum %= 1000000007;
        System.out.println(sum);
    }
}
